<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3"/>
<title>Duye SDK User Wizard: duye::XmlHandle Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Duye SDK User Wizard
   &#160;<span id="projectnumber">V1.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>duye</b></li><li class="navelem"><a class="el" href="classduye_1_1_xml_handle.html">XmlHandle</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classduye_1_1_xml_handle-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">duye::XmlHandle Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>A GXmlHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thing. Note that GXmlHandle is not part of the GnyXml DOM structure. It is a separate utility class.  
 <a href="classduye_1_1_xml_handle.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="duye__xml_8h_source.html">duye_xml.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ad8f20c3cbda416326e5fa4b01e849543"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad8f20c3cbda416326e5fa4b01e849543"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#ad8f20c3cbda416326e5fa4b01e849543">XmlHandle</a> (<a class="el" href="classduye_1_1_xml_node.html">XmlNode</a> *<a class="el" href="classduye_1_1_xml_handle.html#a34202c8a1a7ba3bad454376bded10955">node</a>)</td></tr>
<tr class="memdesc:ad8f20c3cbda416326e5fa4b01e849543"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a handle from any node (at any depth of the tree.) This can be a null pointer. <br/></td></tr>
<tr class="separator:ad8f20c3cbda416326e5fa4b01e849543"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a87d9b1bfd27642642ce91fad541c9522"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a87d9b1bfd27642642ce91fad541c9522"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#a87d9b1bfd27642642ce91fad541c9522">XmlHandle</a> (const <a class="el" href="classduye_1_1_xml_handle.html">XmlHandle</a> &amp;ref)</td></tr>
<tr class="memdesc:a87d9b1bfd27642642ce91fad541c9522"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor. <br/></td></tr>
<tr class="separator:a87d9b1bfd27642642ce91fad541c9522"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a340f92a52e622096042849b97704c543"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a340f92a52e622096042849b97704c543"></a>
<a class="el" href="classduye_1_1_xml_handle.html">XmlHandle</a>&#160;</td><td class="memItemRight" valign="bottom"><b>operator=</b> (const <a class="el" href="classduye_1_1_xml_handle.html">XmlHandle</a> &amp;ref)</td></tr>
<tr class="separator:a340f92a52e622096042849b97704c543"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeaf0a3602fc378ab7166ff850a7edf77"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aeaf0a3602fc378ab7166ff850a7edf77"></a>
<a class="el" href="classduye_1_1_xml_handle.html">XmlHandle</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#aeaf0a3602fc378ab7166ff850a7edf77">firstChild</a> () const </td></tr>
<tr class="memdesc:aeaf0a3602fc378ab7166ff850a7edf77"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return a handle to the first child node. <br/></td></tr>
<tr class="separator:aeaf0a3602fc378ab7166ff850a7edf77"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad3285e5226211a181a45ae4c97ed3906"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad3285e5226211a181a45ae4c97ed3906"></a>
<a class="el" href="classduye_1_1_xml_handle.html">XmlHandle</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#ad3285e5226211a181a45ae4c97ed3906">firstChild</a> (const char *value) const </td></tr>
<tr class="memdesc:ad3285e5226211a181a45ae4c97ed3906"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return a handle to the first child node with the given name. <br/></td></tr>
<tr class="separator:ad3285e5226211a181a45ae4c97ed3906"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae7fb9ef0bb17a19981693df6059ed58c"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae7fb9ef0bb17a19981693df6059ed58c"></a>
<a class="el" href="classduye_1_1_xml_handle.html">XmlHandle</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#ae7fb9ef0bb17a19981693df6059ed58c">firstChildElement</a> () const </td></tr>
<tr class="memdesc:ae7fb9ef0bb17a19981693df6059ed58c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return a handle to the first child element. <br/></td></tr>
<tr class="separator:ae7fb9ef0bb17a19981693df6059ed58c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6235c95236a2c915d558af3ec458e80b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6235c95236a2c915d558af3ec458e80b"></a>
<a class="el" href="classduye_1_1_xml_handle.html">XmlHandle</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#a6235c95236a2c915d558af3ec458e80b">firstChildElement</a> (const char *value) const </td></tr>
<tr class="memdesc:a6235c95236a2c915d558af3ec458e80b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return a handle to the first child element with the given name. <br/></td></tr>
<tr class="separator:a6235c95236a2c915d558af3ec458e80b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad4e0843674c390084f3e34c9dd0efb99"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad4e0843674c390084f3e34c9dd0efb99"></a>
<a class="el" href="classduye_1_1_xml_handle.html">XmlHandle</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#ad4e0843674c390084f3e34c9dd0efb99">child</a> (const char *value, int index) const </td></tr>
<tr class="memdesc:ad4e0843674c390084f3e34c9dd0efb99"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return a handle to the "index" child with the given name. The first child is 0, the second 1, etc. <br/></td></tr>
<tr class="separator:ad4e0843674c390084f3e34c9dd0efb99"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4f2be890e71049ca05b575981cc221bd"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4f2be890e71049ca05b575981cc221bd"></a>
<a class="el" href="classduye_1_1_xml_handle.html">XmlHandle</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#a4f2be890e71049ca05b575981cc221bd">child</a> (int index) const </td></tr>
<tr class="memdesc:a4f2be890e71049ca05b575981cc221bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return a handle to the "index" child. The first child is 0, the second 1, etc. <br/></td></tr>
<tr class="separator:a4f2be890e71049ca05b575981cc221bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac7c47efc26a1bc69c354fec55f56010f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac7c47efc26a1bc69c354fec55f56010f"></a>
<a class="el" href="classduye_1_1_xml_handle.html">XmlHandle</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#ac7c47efc26a1bc69c354fec55f56010f">childElement</a> (const char *value, int index) const </td></tr>
<tr class="memdesc:ac7c47efc26a1bc69c354fec55f56010f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return a handle to the "index" child element with the given name. The first child element is 0, the second 1, etc. Note that only GXmlElements are indexed: other types are not counted. <br/></td></tr>
<tr class="separator:ac7c47efc26a1bc69c354fec55f56010f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5019b79fc90a5f9c78d09846fdfed51a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5019b79fc90a5f9c78d09846fdfed51a"></a>
<a class="el" href="classduye_1_1_xml_handle.html">XmlHandle</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#a5019b79fc90a5f9c78d09846fdfed51a">childElement</a> (int index) const </td></tr>
<tr class="memdesc:a5019b79fc90a5f9c78d09846fdfed51a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return a handle to the "index" child element. The first child element is 0, the second 1, etc. Note that only GXmlElements are indexed: other types are not counted. <br/></td></tr>
<tr class="separator:a5019b79fc90a5f9c78d09846fdfed51a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6d632819324671dc2cc0e5e36fe5b2ea"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6d632819324671dc2cc0e5e36fe5b2ea"></a>
<a class="el" href="classduye_1_1_xml_handle.html">XmlHandle</a>&#160;</td><td class="memItemRight" valign="bottom"><b>firstChild</b> (const std::string &amp;value) const </td></tr>
<tr class="separator:a6d632819324671dc2cc0e5e36fe5b2ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac7f7463b7fd336124ab643839c948c07"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac7f7463b7fd336124ab643839c948c07"></a>
<a class="el" href="classduye_1_1_xml_handle.html">XmlHandle</a>&#160;</td><td class="memItemRight" valign="bottom"><b>firstChildElement</b> (const std::string &amp;value) const </td></tr>
<tr class="separator:ac7f7463b7fd336124ab643839c948c07"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6c7ee9b66280de0b80a9578ac93ad6d6"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6c7ee9b66280de0b80a9578ac93ad6d6"></a>
<a class="el" href="classduye_1_1_xml_handle.html">XmlHandle</a>&#160;</td><td class="memItemRight" valign="bottom"><b>child</b> (const std::string &amp;value, int index) const </td></tr>
<tr class="separator:a6c7ee9b66280de0b80a9578ac93ad6d6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a38f5285940724b402218ee09e52d1f31"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a38f5285940724b402218ee09e52d1f31"></a>
<a class="el" href="classduye_1_1_xml_handle.html">XmlHandle</a>&#160;</td><td class="memItemRight" valign="bottom"><b>childElement</b> (const std::string &amp;value, int index) const </td></tr>
<tr class="separator:a38f5285940724b402218ee09e52d1f31"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac7dc11cbc2ea7743a12eeb50c8937497"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac7dc11cbc2ea7743a12eeb50c8937497"></a>
<a class="el" href="classduye_1_1_xml_node.html">XmlNode</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#ac7dc11cbc2ea7743a12eeb50c8937497">toNode</a> () const </td></tr>
<tr class="memdesc:ac7dc11cbc2ea7743a12eeb50c8937497"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the handle as a <a class="el" href="classduye_1_1_xml_node.html" title="The parent class for everything in the Document Object Model. (Except for attributes). Nodes have siblings, a parent, and children. A node can be in a document, or stand on its own. The type of a XmlNode can be queried, and it can be cast to its more defined type.">XmlNode</a>. This may return null. <br/></td></tr>
<tr class="separator:ac7dc11cbc2ea7743a12eeb50c8937497"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaf7ed88ed4c65ffe47776f63f63e9811"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aaf7ed88ed4c65ffe47776f63f63e9811"></a>
<a class="el" href="classduye_1_1_xml_element.html">XmlElement</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#aaf7ed88ed4c65ffe47776f63f63e9811">toElement</a> () const </td></tr>
<tr class="memdesc:aaf7ed88ed4c65ffe47776f63f63e9811"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the handle as a GXmlElement. This may return null. <br/></td></tr>
<tr class="separator:aaf7ed88ed4c65ffe47776f63f63e9811"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2dfbc8f5f303e1ac5ea5ce06e56cd564"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2dfbc8f5f303e1ac5ea5ce06e56cd564"></a>
<a class="el" href="classduye_1_1_xml_text.html">XmlText</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#a2dfbc8f5f303e1ac5ea5ce06e56cd564">toText</a> () const </td></tr>
<tr class="memdesc:a2dfbc8f5f303e1ac5ea5ce06e56cd564"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the handle as a <a class="el" href="classduye_1_1_xml_text.html" title="XML text. A text node can have 2 ways to output the next. &quot;normal&quot; output and CDATA. It will default to the mode it was parsed from the XML file and you generally want to leave it alone, but you can change the output mode with SetCDATA() and query it with CDATA().">XmlText</a>. This may return null. <br/></td></tr>
<tr class="separator:a2dfbc8f5f303e1ac5ea5ce06e56cd564"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ada5162b3aa12cf26c73e14b47795ab48"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ada5162b3aa12cf26c73e14b47795ab48"></a>
<a class="el" href="classduye_1_1_xml_unknown.html">XmlUnknown</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#ada5162b3aa12cf26c73e14b47795ab48">toUnknown</a> () const </td></tr>
<tr class="memdesc:ada5162b3aa12cf26c73e14b47795ab48"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the handle as a GXmlUnknown. This may return null. <br/></td></tr>
<tr class="separator:ada5162b3aa12cf26c73e14b47795ab48"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a34202c8a1a7ba3bad454376bded10955"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classduye_1_1_xml_node.html">XmlNode</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#a34202c8a1a7ba3bad454376bded10955">node</a> () const </td></tr>
<tr class="separator:a34202c8a1a7ba3bad454376bded10955"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acf58dcd905b9017606e7316fe22892ac"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classduye_1_1_xml_element.html">XmlElement</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#acf58dcd905b9017606e7316fe22892ac">element</a> () const </td></tr>
<tr class="separator:acf58dcd905b9017606e7316fe22892ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a004c8d21525252331f4954a5e36ad54d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classduye_1_1_xml_text.html">XmlText</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#a004c8d21525252331f4954a5e36ad54d">text</a> () const </td></tr>
<tr class="separator:a004c8d21525252331f4954a5e36ad54d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a405bce4aa913198d051a2a573e8b47aa"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classduye_1_1_xml_unknown.html">XmlUnknown</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classduye_1_1_xml_handle.html#a405bce4aa913198d051a2a573e8b47aa">unknown</a> () const </td></tr>
<tr class="separator:a405bce4aa913198d051a2a573e8b47aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A GXmlHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thing. Note that GXmlHandle is not part of the GnyXml DOM structure. It is a separate utility class. </p>
<p>Take an example: </p>
<pre class="fragment"> * &lt;Document&gt;
 * &lt;Element attributeA = "valueA"&gt;
 * &lt;Child attributeB = "value1" /&gt;
 * &lt;Child attributeB = "value2" /&gt;
 * &lt;/Element&gt;
 * &lt;Document&gt;
 * </pre><p>Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very easy to write a <em>lot</em> of code that looks like:</p>
<pre class="fragment"> */
 /*
GXmlElement* root = document.FirstChildElement( "Document" );
if ( root )
{
GXmlElement* element = root-&gt;FirstChildElement( "Element" );
if ( element )
{
    GXmlElement* child = element-&gt;FirstChildElement( "Child" );
    if ( child )
    {
        GXmlElement* child2 = child-&gt;NextSiblingElement( "Child" );
        if ( child2 )
        {
            // Finally do something useful.</pre><p>And that doesn't even cover "else" cases. GXmlHandle addresses the verbosity of such code. A GXmlHandle checks for null pointers so it is perfectly safe and correct to use:</p>
<pre class="fragment">    GXmlHandle docHandle( &amp;document );
    GXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement();
    if ( child2 )
    {
        // do something useful</pre><p>Which is MUCH more concise and useful.</p>
<p>It is also safe to copy handles - internally they are nothing more than node pointers. </p>
<pre class="fragment">    GXmlHandle handleCopy = handle;</pre><p>What they should not be used for is iteration:</p>
<pre class="fragment">    int i=0; 
    while ( true )
    {
        GXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement();
        if ( !child )
            break;
        // do something
        ++i;
    }</pre><p>It seems reasonable, but it is in fact two embedded while loops. The Child method is a linear walk to find the element, so this code would iterate much more than it needs to. Instead, prefer:</p>
<pre class="fragment">    GXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement();

    for( child; child; child=child-&gt;NextSiblingElement() )
    {
        // do something
    }</pre> </div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="acf58dcd905b9017606e7316fe22892ac"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classduye_1_1_xml_element.html">XmlElement</a>* duye::XmlHandle::element </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000002">Deprecated:</a></b></dt><dd>use ToElement. Return the handle as a GXmlElement. This may return null. </dd></dl>

</div>
</div>
<a class="anchor" id="a34202c8a1a7ba3bad454376bded10955"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classduye_1_1_xml_node.html">XmlNode</a>* duye::XmlHandle::node </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000001">Deprecated:</a></b></dt><dd>use ToNode. Return the handle as a <a class="el" href="classduye_1_1_xml_node.html" title="The parent class for everything in the Document Object Model. (Except for attributes). Nodes have siblings, a parent, and children. A node can be in a document, or stand on its own. The type of a XmlNode can be queried, and it can be cast to its more defined type.">XmlNode</a>. This may return null. </dd></dl>

</div>
</div>
<a class="anchor" id="a004c8d21525252331f4954a5e36ad54d"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classduye_1_1_xml_text.html">XmlText</a>* duye::XmlHandle::text </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000003">Deprecated:</a></b></dt><dd>use ToText() Return the handle as a <a class="el" href="classduye_1_1_xml_text.html" title="XML text. A text node can have 2 ways to output the next. &quot;normal&quot; output and CDATA. It will default to the mode it was parsed from the XML file and you generally want to leave it alone, but you can change the output mode with SetCDATA() and query it with CDATA().">XmlText</a>. This may return null. </dd></dl>

</div>
</div>
<a class="anchor" id="a405bce4aa913198d051a2a573e8b47aa"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classduye_1_1_xml_unknown.html">XmlUnknown</a>* duye::XmlHandle::unknown </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000004">Deprecated:</a></b></dt><dd>use ToUnknown() Return the handle as a GXmlUnknown. This may return null. </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>Z:/duye/src/duyebase/utils/<a class="el" href="duye__xml_8h_source.html">duye_xml.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Feb 27 2017 15:19:23 for Duye SDK User Wizard by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.3
</small></address>
</body>
</html>
